#!/bin/bash

dbname="recommendationengine"

mysql -uroot -pmysql -h127.0.0.1 --default-character-set=utf8 -e "DROP DATABASE IF EXISTS $dbname"
mysql -uroot -pmysql -h127.0.0.1 --default-character-set=utf8 -e "CREATE DATABASE IF NOT EXISTS $dbname DEFAULT CHARACTER SET utf8"
mysql -uroot -pmysql -h127.0.0.1 --default-character-set=utf8 $dbname -e "source recommendationengine.sql"
mysql -uroot -pmysql -h127.0.0.1 --default-character-set=utf8 $dbname -e "source data.sql"
mysql -uroot -pmysql -h127.0.0.1 --default-character-set=utf8 $dbname -e "source routines.sql"

mysql -uroot -pmysql -h127.0.0.1 --default-character-set=utf8 $dbname -e "insert into etl_log values ('viewlog', '20140917')"
mysql -uroot -pmysql -h127.0.0.1 --default-character-set=utf8 $dbname -e "insert into etl_log values ('output',  '2014091712')"
